#ifndef SUPERELEMENT_HPP_
#define SUPERELEMENT_HPP_

/*! \file superelement.hpp
 * \brief defines class SuperElement used to provide geometric data
 */ 

#include <stddef.h>
#include <stdexcept>
#include <iostream>
#include "blinalg.hpp"
// -----------------------------------------------------------------------
/*! \class FElement
 * \author Thanh
 * \version 0.1
 * \date 17.09.2011
 * \brief FElement provides all data concerning a finite element
*/
class FElement
{
  //private:
private:
  double vertex0_coord_; //!< coordinate of the first vertex
  double vertex1_coord_; //!< coordinate of the second vertex
  double midpoint_; //!< midpoint of the element
  myindex index_; //!< internal index of the element
  myindex level_; //!< refinement level in mesh hierarchy
  myindex vertex0_index_; //!< index of first vertex
  myindex vertex1_index_; //!< index of second vertex
  myindex midpoint_index_; //!< index of midpoint vertex
  myindex father_; //!< index of father triangle
  double area_; //!< area/length of the element
  
public:
  FElement (); //!< constructor of FElement
  ~FElement (); //!< destructor of FElement
  // use standard copy constructor
  void fill (const double& vertex0_coord, const double& vertex1_coord, 
	const myindex vertex0_index, const myindex vertex1_index, 
	const myindex midpoint_index, const myindex level, const myindex idx,
	const myindex father); //!< puts data to FElement

  myindex getIndex () const; //!< returns index of the element
  myindex getLevel () const; //!< returns refinement level in Mesh hierarchy
  myindex getVertexIndex (myindex idx) const; //!< returns index of vertex idx
  myindex getMidpointIndex () const; //!< returns index of midpoint
  myindex getFather () const; //!< returns index of father triangle
  double getVertexCoord (myindex idx) const; //!< returns coord of vertex idx
  double getArea () const; //!< returns are/size of the element
  double getMidpoint () const; //!< returns coord of the midpoint of the element
  void printFE();
}; // class FElement


std::ostream& operator<< (std::ostream& s, const FElement& el); //!< defines ostream for FElement

#endif //ifndef SUPERELEMENT_HPP_
